<template>
	<view class="container">
		<view v-for="(item, index) in datalist" :key="item.nID" class="card-wrapper">
			<view class="card">
				<text class="title">{{ item.title }}</text>
				
				<view class="info-bar">
					<text v-if="item.isTop" class="top-tag">置顶</text>
					<text class="author">{{ item.author }}</text>
					<text class="comments">{{ item.comments }}评</text>
					<text class="time">{{ item.time }}</text>
				</view>
				
				<view v-if="item.showSearch" class="search-tips">
					<text class="search-text">搜索：</text>
					<view class="tag-box">
						<text class="tag">今日金价</text>
					</view>
					<view class="tag-box">
						<text class="tag">精选好物</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>


<script>
	export default {
		data() {
			return {
				datalist: [
					{
						nID: "T15627",
						title: "14个月从100家开到1000家门店，蜜雪冰城为何买下这家精酿啤酒商",
						isTop: true,
						author: "界面新闻",
						comments: 56,
						time: "2025.10.07",
						showSearch: false
					},
					{
						nID: "B4485",
						title: "把握历史大势 共创美好未来（观沧海）",
						isTop: false,
						author: "人民日报",
						comments: 1025,
						time: "2025.10.25",
						showSearch: false
					},
					{
						nID: "G1234",
						title: "黄金还能走多远？卖方高呼“第三浪启动”，230多份研报看多",
						isTop: false,
						author: "财联社",
						comments: 452,
						time: "2025.10.08",
						showSearch: true
					},
					{
						nID: "S5678",
						title: "“没有短板”的完美战鹰！歼-16机库独家探访",
						isTop: false,
						author: "红星新闻",
						comments: 56,
						time: "2025.10.07",
						showSearch: false
					},
					{
						nID: "A9012",
						title: "多国学者共探巴克特里亚考古 携手推进丝绸之路文明研究新进程",
						isTop: false,
						author: "中国日报网",
						comments: 56,
						time: "2025.10.12",
						showSearch: false
					}
				]
			}
		}
	}
</script>

<style>
	.container {
		padding: 20rpx;
		background-color: #f5f5f5;
		min-height: 100vh;
	}
	
	.card-wrapper {
		margin-bottom: 20rpx;
	}
	
	.card {
		background: #e7fffc;
		border-radius: 12rpx;
		padding: 30rpx;
		box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.08);
	}
	
	.title {
		font-size: 32rpx;
		font-weight: 600;
		color: #333333;
		line-height: 1.5;
		display: block;
		margin-bottom: 24rpx;
	}
	
	.info-bar {
		display: flex;
		align-items: center;
		font-size: 26rpx;
		color: #999999;
		line-height: 1.4;
	}
	
	.top-tag {
		color: #ff3b30;
		margin-right: 20rpx;
		font-size: 24rpx;
	}
	
	.author {
		margin-right: 20rpx;
		color: #666666;
	}
	
	.comments {
		margin-right: auto;
		color: #999999;
	}
	
	.time {
		color: #999999;
		font-size: 24rpx;
	}
	
	.search-tips {
			display: flex;
			align-items: center;
			margin-top: 20rpx;
			/* 去掉上边框 */
			padding-top: 0;
			/* 移除 border-top 属性 */
		}
	
	.search-text {
		font-size: 26rpx;
		color: #6380ff;
		margin-right: 20rpx;
	}
	
	.tag-box {
		border: 1rpx solid #e0e0e0;
		border-radius: 6rpx;
		padding: 8rpx 16rpx;
		margin-right: 16rpx;
	}
	
	.tag {
		font-size: 24rpx;
		color: #6380ff;
	}
</style>